﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RMS.Utils.MVP;
using RMS.Web.Shell.View;
using RMS.DataAccess.Entities;
using RMS.DataAccess.Repositories;
using RMS.Utils.Authentication;

namespace RMS.Web.Shell.Presenter
{
    public class ProfilePresenter : Presenter<IProfileView>
    {
        EmployeesRepository _employeesRepository;
        IAuthentication _iAuthentication;
        public ProfilePresenter(EmployeesRepository employeesRepository, IAuthentication iAuthentication)
        {
            _employeesRepository = employeesRepository;
            _iAuthentication = iAuthentication;
        }

        public Employees getEmployeeInfo()
        {
            return _employeesRepository.Find(item => item.Employee_id = _iAuthentication.CurrentLogedInMember.Id).Single();
        }

        public bool UpadateEmployee(Employees employee)
        {
            employee.Employee_id = _iAuthentication.CurrentLogedInMember.Id;
            _employeesRepository.Update(employee);
            return true;
        }
    }
}
